package com.example.chao.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.chao.dto.ChaoDTO;
import com.example.chao.entity.Chao;
import com.example.chao.mapper.ChaoMapper;
import com.example.chao.service.ChaoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: WangYongChao
 * @Date: 2021/08/10/22:10
 * @Description: service实现类
 */
@Service
@Transactional
public class ChaoServiceImpl extends ServiceImpl<ChaoMapper, Chao> implements ChaoService {

    /**
     * 根据name查value
     * @param name 姓名
     * @return
     */
    @Override
    public String selectValue(String name) {
        return baseMapper.selectValue(name);
    }

    /**
     * 分页查询所有数据
     * @param chaoDTO 对象参数
     * @return
     */
    @Override
    public IPage<Chao> selectAll(ChaoDTO chaoDTO) {
        Page<ChaoDTO> page=new Page<>(chaoDTO.getPageNo(), chaoDTO.getPageSize());
        IPage<Chao> newPage=baseMapper.selectAll(page);
        return newPage;
    }

    /**
     * sql校验
     * @param sql sql字符串
     * @return
     */
    @Override
    public Map<String,Object> checkSql(String sql) {
        return baseMapper.checkSql(sql);
    }

    /**
     * 购买者信息
     * @param paramMap
     * @return
     */
    @Override
    public Map<String, Object> orderdto(Map paramMap) {
        return baseMapper.orderdto(paramMap);
    }

    /**
     * 批量插入
     * @param paramMap
     * @return
     */
    @Override
    public void batchInsert(Map paramMap) {
        baseMapper.batchInsert(paramMap);
    }

    /**
     * 批量查询
     * @param paramMap
     * @return
     */
    @Override
    public List<Map<String, Object>> batchSelect(Map paramMap) {
        return baseMapper.batchSelect(paramMap);
    }

    /**
     * 批量更新
     * @param paramMap
     * @return
     */
    @Override
    public void batchUpdate(Map paramMap) {
        baseMapper.batchUpdate(paramMap);
    }

    /**
     * 批量删除
     * @param paramMap
     */
    @Override
    public void batchDelete(Map paramMap) {
        baseMapper.batchDelete(paramMap);
    }

}
